//Rust 入门例子
fn main() {
    //hello word
    println!("Hello Word");

    let rust = "Rust";
    println!("Hello ,{}",rust);

    let a1 = 5;
    let a2: i32 = 5;
    //assert_eq!宏判断两个参数是否相等，包括参数的类型。不相等程序会报错
    assert_eq!(a1,a2);

    let mut a: f64 = 1.0;
    let b = 2.0f32;
    println!("a={}",a);
    a = 2.0;
    println!("a={},b={}",a,b);

    let (t,mut f) = (true,false);
    println!("t={},f={}",t,f);
    f = true;
    assert_eq!(t,f);

    //数组
    let mut array = [0;3];
    array[1] = 1;
    array[2] = 2;

    assert_eq!([1,2],&array[1..]);

    for x in &array{
        println!("{}",x);
    }

    //动态数组
    //创建空Vec
    let v: Vec<i32> = Vec::new();
    //使用宏创建空Vec
    let v: Vec<i32> = vec![];
    //创建包含5个元素
    let v: Vec<i32> = vec![1,2,3,4,5];


}
